package com.xinqi.modules.chat.chat.message.controller.app;

import com.xinqi.common.base.response.R;
import com.xinqi.common.satoken.utils.LoginHelper;
import com.xinqi.modules.chat.chat.message.service.ChatMessageCountService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * APP-陌生人聊天限制
 *
 * @version V1.0
 * @Title:
 * @ClassName: com.xinqi.modules.chat.chat.message.controller.app.ChatMessageCountAppController.java
 * @Description:
 * @Copyright 星齐科技（云南）有限公司 - Powered By 技术部
 * @author: yyzhen
 * @date: 2023/6/2 22:01
 */
@Validated
@RestController
@RequestMapping("/app/message-count")
@RequiredArgsConstructor
public class ChatMessageCountAppController {
    private final ChatMessageCountService chatMessageCountService;

    @Operation(summary = "获取用户陌生人聊天限制")
    @GetMapping("/check/{userId}")
    public R<Boolean> info(@NotNull(message = "{user.id.not.black}") @PathVariable("userId") Long userId) {
        return R.data(chatMessageCountService.checkCount(userId, LoginHelper.getUserId()));
    }


}
